package guoanmaker.operator.business.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import guoanmaker.operator.business.model.OperatorHotBusinessNewForAPP;
import guoanmaker.operator.business.model.ProviderBusiness;

public interface OperatorHotBusinessNewForAPPRepository extends JpaRepository<OperatorHotBusinessNewForAPP, String>, JpaSpecificationExecutor<OperatorHotBusinessNewForAPP> {
	 @Modifying
	 @Query(value = "delete from t_operator_hot_business_new_for_app  where city_code=:cityCode ", nativeQuery = true)
	 public void deleteAllOperatorHotBusinessNew(@Param("cityCode") String cityCode);
	 
	 @Query("select b from OperatorHotBusinessNewForAPP b where b.cityCode=:cityCode")
	 public List<OperatorHotBusinessNewForAPP> findOperatorHotBusinessNewByCityCode(@Param("cityCode") String cityCode);
	 @Query("select b from ProviderBusiness b inner join b.personalUser u  where  u.isProvider =2 and b.busNumber =:busNumber ")
	 public ProviderBusiness selectProviderBusiness(@Param("busNumber") String busNumber);

}
